package com.dingxin.portal.common.utils.converters;

import org.apache.commons.beanutils.ConversionException;
import org.apache.commons.beanutils.Converter;

public class EnumConverter implements Converter{

	public Object convert(Class type, Object value) {

		if (value == null) {
			throw new ConversionException("No value specified");
		}

		if (type.isEnum()) {
			return Enum.valueOf(type, value.toString());
		} else {
			return null;
		}
	}
}
